﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Vortex.Input {

	/// <summary>
	/// Contains basic information about key states on input action moment
	/// </summary>
	public abstract class InputActionInfo {
		KeyStates _keyStates;

		/// <summary>
		/// Initializes a new instance of the <see cref="InputActionInfo"/> class.
		/// </summary>
		/// <param name="keyStates">The key states on the input action moment.</param>
		protected InputActionInfo(KeyStates keyStates) {
			_keyStates = keyStates;
		}

		/// <summary>
		/// Gets key states on the moment of action.
		/// </summary>
		/// <value>The key states.</value>
		public KeyStates KeyStates {
			get { return _keyStates; }
		}

		/// <summary>
		/// Gets a value indicating whether Control was down on the action moment.
		/// </summary>
		/// <value>
		/// 	<c>true</c> if Control was down at the action moment; otherwise, <c>false</c>.
		/// </value>
		public bool IsControlDown {
			get { return (_keyStates & KeyStates.Control) != KeyStates.None; }
		}

		/// <summary>
		/// Gets a value indicating whether Shift was down on the action moment.
		/// </summary>
		/// <value>
		/// 	<c>true</c> if Shift was down at the action moment; otherwise, <c>false</c>.
		/// </value>
		public bool IsShiftDown {
			get { return (_keyStates & KeyStates.Shift) != KeyStates.None; }
		}

		/// <summary>
		/// Gets a value indicating whether left mouse button was down on the action moment.
		/// </summary>
		/// <value>
		/// 	<c>true</c> if left mouse button was down at the action moment; otherwise, <c>false</c>.
		/// </value>
		public bool IsLeftButtonDown {
			get { return (_keyStates & KeyStates.LeftButton) != KeyStates.None; }
		}

		/// <summary>
		/// Gets a value indicating whether middle mouse button was down on the action moment.
		/// </summary>
		/// <value>
		/// 	<c>true</c> if middle mouse button was down at the action moment; otherwise, <c>false</c>.
		/// </value>
		public bool IsMiddleButtonDown {
			get { return (_keyStates & KeyStates.MiddleButton) != KeyStates.None; }
		}

		/// <summary>
		/// Gets a value indicating whether right mouse button was down on the action moment.
		/// </summary>
		/// <value>
		/// 	<c>true</c> if right mouse button was down at the action moment; otherwise, <c>false</c>.
		/// </value>
		public bool IsRightButtonDown {
			get { return (_keyStates & KeyStates.RightButton) != KeyStates.None; }
		}

	}
}
